<div class="issue-event-container">
  <%= case @event do %>
    <% %{
      "type" => "title_update",
      "new_title" => new_title,
      "old_title" => old_title,
      "timestamp" => timestamp,
      "user" => user
    } -> %>
      <div class="timeline-marker is-icon">
        <i class="fa fa-pen"></i>
      </div>
      <div class="timeline-content">
        <a href={Routes.user_path(@socket, :show, user)} class="has-text-black"><%= user.login %></a>
        changed the title <em class="has-text-black"><s><%= old_title %></s></em> to <em class="has-text-black"><%= new_title %></em>
        <%= datetime_format(NaiveDateTime.from_iso8601!(timestamp), "{relative}") %>
      </div>
    <% %{
      "type" => "close",
      "timestamp" => timestamp,
      "user" => user
    } -> %>
      <div class="timeline-marker is-icon is-danger">
        <i class="fa fa-check"></i>
      </div>
      <div class="timeline-content">
        <a href={Routes.user_path(@socket, :show, user)} class="has-text-black"><%= user.login %></a>
        closed this issue <%= datetime_format(NaiveDateTime.from_iso8601!(timestamp), "{relative}") %>
      </div>
    <% %{
      "type" => "reopen",
      "timestamp" => timestamp,
      "user" => user
    } -> %>
      <div class="timeline-marker is-icon is-success">
        <i class="fa fa-redo"></i>
      </div>
      <div class="timeline-content">
        <a href={Routes.user_path(@socket, :show, user)} class="has-text-black"><%= user.login %></a>
        reopened this issue <%= datetime_format(NaiveDateTime.from_iso8601!(timestamp), "{relative}") %>
      </div>
    <% %{
      "type" => "labels_update",
      "push" => push_ids,
      "pull" => pull_ids,
      "timestamp" => timestamp,
      "user" => user
    } -> %>
      <div class="timeline-marker is-icon">
        <i class="fa fa-tag"></i>
      </div>
      <div class="timeline-content">
        <a href={Routes.user_path(@socket, :show, user)} class="has-text-black"><%= user.login %></a>
        <%= unless Enum.empty?(push_ids) do %>
          added
          <%= for label_id <- push_ids do %>
            <%= GitGud.Web.IssueLabelView.label_button(Enum.find(@repo.issue_labels, &(&1.id == label_id))) %>
          <% end %>
          <%= unless Enum.empty?(pull_ids) do %>and<% end %>
        <% end %>
        <%= unless Enum.empty?(pull_ids) do %>
          removed
          <%= for label_id <- pull_ids do %>
            <%= GitGud.Web.IssueLabelView.label_button(Enum.find(@repo.issue_labels, &(&1.id == label_id))) %>
          <% end %>
        <% end %>
        <%= datetime_format(NaiveDateTime.from_iso8601!(timestamp), "{relative}") %>
      </div>
    <% %{
      "type" => "commit_reference",
      "commit_hash" => commit_oid,
      "timestamp" => timestamp,
      "user" => user
    } -> %>
      <div class="timeline-marker is-icon">
        <i class="fa fa-code-commit"></i>
      </div>
      <div class="timeline-content">
        <a href={Routes.user_path(@socket, :show, user)} class="has-text-black"><%= user.login %></a>
        referenced this issue in commit
        <a href={Routes.codebase_path(@socket, :commit, @repo.owner_login, @repo, commit_oid)}><code class="has-text-link"><%= String.slice(commit_oid, 0, 7) %></code></a>
        <%= datetime_format(NaiveDateTime.from_iso8601!(timestamp), "{relative}") %>
      </div>
  <% end %>
</div>